package com.yfqy.admin.domain.dto.auth;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;

/**
 * @Author: 梁二东
 * @Date: 2025/5/9 07:44
 * @Description:
 **/
@Data
public class Authority implements GrantedAuthority {
    private Long id;
    private String code;      // 权限编码，如 "user:read"
    private String name;      // 权限名称，如 "读取用户"
    private String category;  // 权限分类（可选）

    @Override
    public String getAuthority() {
        return this.code; // Spring Security 通过此方法获取权限标识
    }

    public Authority(String code) {
        this.code = code;
    }
}
